'use strict';
const WXBizDataCrypt = require("./WXBizDataCrypt.js");
const { appId } = require('wx-common');
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event);
	const { sessionKey ,encryptedData ,iv } = event;
	const cryPt = new WXBizDataCrypt(appId,sessionKey);
	const data = cryPt.decryptData(encryptedData, iv);
	// console.log(JSON.stringify(data),'data')
	//返回数据给客户端
	return data
};
